package com.example.tests;


import static com.example.fw.ContactHelper.CREATION;

import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.*;

import org.testng.annotations.Test;

import com.example.utils.SortedListOf;

public class ContactCreationTests extends TestBase{
		
	
	@Test(dataProvider = "randomValidContactGenerator")
	public void testEmptyContactCreation(ContactData contact) throws Exception {
		
		// save old state
		SortedListOf<ContactData> oldList = app.getContactHelper().getContacts();
				
		// actions	
		app.getContactHelper().createContact(contact, CREATION);
		
		
		// save new state
		SortedListOf<ContactData> newList = app.getContactHelper().getContacts();
		

		// compare states
		// assertEquals(newList.size(), oldList.size() + 1);
		assertThat(newList, equalTo(oldList.withAdded(contact)));		
		
	}

}

